
<style>
    #categories-table tbody td {
        cursor: pointer;
    }

    #categories-table tbody tr.selected td {
        background-color: #347892 !important;
        color: #fff;
    }

    #categories-table tbody tr.selected td .text-muted {
        color: #eee;
    }
</style>

<div class="" id="container">

    <div class="row">

        <div class="col-lg-4">
            <div class="panel">
                <div class="panel-heading">
                    <div class="row">
                        <div class="col-lg-8">Categories List</div>

                        <div class="col-lg-4 text-right">
                            <button href='<?php echo $this->Html->url(array('action' => 'category', 'add')); ?>' id='add_btn' title="Add Category" class="btn btn-sm btn-white">
                                <i class="fa fa-plus"></i>
                            </button>
                            
                            <button href='<?php echo $this->Html->url(array('action' => 'category', 'delete')); ?>' id='del_btn' title="Remove Category" class="btn btn-sm btn-white">
                                <i class="fa fa-minus"></i>
                            </button>
                        </div>
                    </div>
                </div>

                <div class="panel-body no-padder">
                    <table id="categories-table" class="table table-striped table-hover">
                        <thead>
                            <tr>
                                <th width="30">
                                    <input type="checkbox" />
                                </th>
                                <th>Name</th>
                            </tr>
                        </thead>

                        <tbody>
                            <?php
                            foreach ($categories as $cat) {
                                ?>
                                <tr>
                                    <td>
                                        <input type="checkbox" value="<?php echo $cat['category']['id']; ?>" />
                                    </td>
                                    <td class="info" data-id="<?php echo $cat['category']['id']; ?>">
                                        <?php echo $cat['category']['name']; ?>
                                        
                                        <?php 
                                        if( $cat['category']['default'] == 1 ) {
                                            echo "<i class='fa fa-check text-success pull-right'></i>";
                                        } 
                                        ?>
                                    </td>
                                </tr>
                                <?php
                            }
                            ?>
                        </tbody>

                    </table>
                </div>
            </div>
        </div>


        <div class="col-lg-8">
            <div class="panel m-b-none" id="category_view">
                <div class='panel-heading'>
                    <div class='row'>
                        <div class='col-lg-9'>
                            
                        </div>
                        <div class='col-lg-3'>
                            <button id='edit_btn' class='btn btn-sm btn-info pull-right'>
                                <i class='fa fa-pencil'></i> Edit
                            </button>
                        </div>
                    </div>
                </div>
                <div class="panel-body m-b-none">

                </div>
            </div>
        </div>
    </div>
</div>

<input type="hidden" id="category_detail_url" value="<?php echo $this->Html->url(array('action' => 'category_detail')); ?>" />
<input type="hidden" id="category_editor_url" value="<?php echo $this->Html->url(array('action' => 'category')); ?>" />

<?php
echo $this->Html->script('plugins/jquery.trocar/jquery.trocar.js');
echo $this->Html->script('plugins/jquery.friendurl/jquery.friendurl.min.js');
echo $this->Html->script('app/views/settings/categories.js');
?>